import 'package:http/http.dart' as http;
//https://api.dartlang.org/stable/1.24.3/dart-convert/dart-convert-library.html
import 'dart:convert';

const dadJokeApi = "https://icanhazdadjoke.com/";
const httpHeaders = const {
  'User-Agent': 'DadJokes (https://github.com/timsneath/dadjokes)',
  'Accept': 'application/json',
};

main() async {
  final response = await http.read(dadJokeApi, headers: httpHeaders);
  final decoded = json.decode(response);
  if (decoded['status'] == 200) {
    print(decoded['joke']);
  }
}
//EOP
